﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.VisualBasic.ApplicationServices;
using WinFormsAppTest.Dao;

namespace WinFormsAppTest.Service
{
    internal class AdminService
    {

        public int FindIsAdmin(String uname, String upassword)
        {
            AdminDao admindao = new AdminDao();
            if (admindao.FindIsAdmin(uname, upassword) != 0)
            {
                int id = admindao.FindIsAdmin(uname, upassword);
                //MessageBox.Show("登录成功！");
                return id;
            }
            else
            {
                //MessageBox.Show("登录失败！");
                return 0;
            }
        }


        public List<WinFormsAppTest.pojo.User> GetUserById(int id)
        {
            AdminDao admindao = new AdminDao();
            List<WinFormsAppTest.pojo.User> users = admindao.GetUserById(id);
            return users;
        }

        public List<WinFormsAppTest.pojo.User> GetUserByName(string name)
        {
            AdminDao admindao = new AdminDao();
            List<WinFormsAppTest.pojo.User> users = admindao.GetUserByName(name);
            return users;
        }


        public List<WinFormsAppTest.pojo.User> GetUsers()
        {
            AdminDao admindao = new AdminDao();
            List<WinFormsAppTest.pojo.User> users = admindao.GetUsers();
            return users;
        }

        //admin 主体  开始
        public List<WinFormsAppTest.pojo.Admin> GetAdmins()
        {
            AdminDao admindao = new AdminDao();
            List<WinFormsAppTest.pojo.Admin> admins = admindao.GetAdmins();
            return admins;
        }

        public List<WinFormsAppTest.pojo.Admin> GetAdminById(int id)
        {
            AdminDao admindao = new AdminDao();
            List<WinFormsAppTest.pojo.Admin> users = admindao.GetAdminById(id);
            return users;
        }

        public List<WinFormsAppTest.pojo.Admin> GetAdminByName(string name)
        {
            AdminDao admindao = new AdminDao();
            List<WinFormsAppTest.pojo.Admin> users = admindao.GetAdminByName(name);
            return users;
        }

        //admin 主体  结束

        public List<Class.Files> GetFiles()
        {
            AdminDao userdao = new AdminDao();
            List<Class.Files> files = userdao.GetUserFiles();
            return files;
        }

        public List<WinFormsAppTest.pojo.Change> GetUserChange()
        {
            AdminDao userdao = new AdminDao();
            List<WinFormsAppTest.pojo.Change> change = userdao.GetUserChange();
            return change;
        }

        public List<WinFormsAppTest.pojo.Exam> GetUserExam()
        {
            AdminDao userdao = new AdminDao();
            List<WinFormsAppTest.pojo.Exam> exam = userdao.GetUserExam();
            return exam;
        }

        public List<WinFormsAppTest.pojo.Work> GetUserWork()
        {
            AdminDao userdao = new AdminDao();
            List<WinFormsAppTest.pojo.Work> work = userdao.GetUserWork();
            return work;
        }

        public List<WinFormsAppTest.pojo.Signs> GetUserSigns()
        {
            AdminDao userdao = new AdminDao();
            List<WinFormsAppTest.pojo.Signs> signs = userdao.GetUserSigns();
            return signs;
        }

        public List<WinFormsAppTest.pojo.Overtime> GetUserOvertime()
        {
            AdminDao userdao = new AdminDao();
            List<WinFormsAppTest.pojo.Overtime> overtime = userdao.GetUserOvertime();
            return overtime;
        }

        public List<WinFormsAppTest.pojo.Outtime> GetUserOuttime()
        {
            AdminDao userdao = new AdminDao();
            List<WinFormsAppTest.pojo.Outtime> outtime = userdao.GetUserOuttime();
            return outtime;
        }

    }
}
